package day14;

import java.util.concurrent.ArrayBlockingQueue;

public class Foodie1 extends Thread {
    private int count;
    private ArrayBlockingQueue<String> ab;

    Foodie1(ArrayBlockingQueue<String> ab) {
        this.ab = ab;
    }

    @Override
    public void run() {
        while (true) {
            if (count == 10) {
                break;
            } else {
                try {
                    String take = ab.take();
                    System.out.println("吃货将" + take + "拿出来吃了");
                    count++;
                } catch (InterruptedException e) {
                    e.printStackTrace();

                }
            }
        }
    }
}
